home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmiSoft / Dev / Gui / Cit.lha / CIT / Demo / PopUpWindTest.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2003-02-15  |  1.9 KB  |  99 lines

  1. #include "CITGroup.h"
  2. #include "CITLabel.h"
  3. #include "CITButton.h"
  4. #include "CITPopUpWindow.h"
  5.  
  6. CITApp Application;
  7.  
  8. CITScreen DemoScreen;
  9. CITWindow DemoWindow;
  10. CITVGroup group;
  11. CITButton quitButton;
  12. CITButton popupButton;
  13.  
  14. void closeEvent();
  15. void popupEvent(ULONG ID,ULONG eventFlag);
  16. void quitEvent(ULONG ID,ULONG eventFlag);
  17.  
  18. int main(void)
  19. {
  20.   BOOL Error=FALSE;
  21.  
  22.   DemoScreen.Display("Workbench");
  23.   DemoScreen.InsObject(DemoWindow,Error);
  24.     DemoWindow.Position(30,30);
  25.     DemoWindow.CloseGadget();
  26.     DemoWindow.DragBar();
  27.     DemoWindow.DepthGadget();
  28.     DemoWindow.Activate();
  29.     DemoWindow.SizeGadget();
  30.     DemoWindow.IconifyGadget();
  31.     DemoWindow.Caption("CITGadgets");
  32.     DemoWindow.CloseEventHandler(closeEvent);
  33.     DemoWindow.InsObject(group,Error);
  34.       group.BevelStyle();
  35.       group.BevelLabel("En tekst");
  36.       group.InsObject(popupButton,Error);
  37.         popupButton.Text("Pop Up");
  38.         popupButton.EventHandler(popupEvent);
  39.       group.InsObject(quitButton,Error);
  40.         quitButton.Text("Quit");
  41.         quitButton.EventHandler(quitEvent);
  42.  
  43.  
  44.   Application.InsObject(DemoScreen,Error);
  45.  
  46.   if( Error )
  47.     return 10;
  48.   else
  49.   {
  50.     Application.Run();
  51.     return 0;
  52.   }
  53. }
  54.  
  55. void closeEvent()
  56. {
  57.   Application.Stop();
  58. }
  59.  
  60. void quitEvent(ULONG ID,ULONG eventFlag)
  61. {
  62.   Application.Stop();
  63. }
  64.  
  65. void popupEvent(ULONG ID,ULONG eventFlag)
  66. {
  67.   CITPopUpWindow popupWd;
  68.   CITLabel       label;
  69.  
  70.   BOOL Error = FALSE;
  71.  
  72.   popupWd.Position(100,100);
  73.   popupWd.Size(250,120);
  74.   popupWd.CloseGadget();
  75.   popupWd.Caption("Pop Up");
  76.   popupWd.InsAcceptButton("Ok",Error);
  77.   popupWd.InsCancelButton(Error);
  78.     popupWd.AcceptMinHeight(25);
  79.   popupWd.InsObject(label,Error);
  80.     label.Text("Hello!\n");
  81.  
  82.   DemoScreen.InsObject(popupWd,Error);
  83.  
  84.   if( !Error )
  85.   {
  86.     UWORD  retval;
  87.  
  88.     retval = Application.Run(MAIN_STOPMASK|POPUP_CLOSE|POPUP_ACCEPT|POPUP_CANCEL);
  89.  
  90.     if( retval & POPUP_ACCEPT )
  91.     {
  92.       // Do something
  93.     }
  94.  
  95.     DemoScreen.RemObject(popupWd);
  96.   }
  97.  
  98. }
  99.